import { createWebHistory } from "vue-router";
import { createRouter } from "vue-router";

import Register from "@/views/register.vue";
import mainPage from "@/views/mainPage.vue";
import UserInfo from "@/views/user/UserBaseInfo.vue";
import UserAvatar from "@/views/user/UserAvatar.vue";
import UserResetPsd from "@/views/user/UserResetPassword.vue";
import ArticleCategory from "@/views/article/ArticleCategory.vue";
import ArticleManage from "@/views/article/ArticleManage.vue";
import test from "@/views/LLM/test.vue"
import graph from "@/views/LLM/GraphRag.vue"
import NoAuth from "@/components/NoAuth.vue";
import {AccessEnum} from "@/access/accessEnums.js";
import AdminUserPage from "@/views/admin/adminUserPage.vue";
import AdminAppPage from "@/views/admin/adminAppPage.vue";
import AdminQuestionPage from "@/views/admin/adminQuestionPage.vue";
import AdminReviewPage from "@/views/admin/adminReviewPage.vue";
import AdminUserAnswerPage from "@/views/admin/adminUserAnswerPage.vue";
import AppHome from "@/views/App/AppHome.vue";
import AppDetail from "@/components/app/appDetail.vue";
import AnswerDo from "@/components/question/AnswerDo.vue";
import AddQuestion from "@/components/question/AddQuestion.vue";
import AddScoringResult from "@/components/scoring/AddScoringResult.vue";
import UserAnswer from "@/components/userAnswer/UserAnswer.vue";
import MyApp from "@/views/App/MyApp.vue";
import AllMyFileList from "@/components/graph/AllMyFileList.vue";
import ChatPage from "@/components/graph/ChatPage.vue";
import ChatPage2 from "@/components/graph/ChatPage2.vue";
const routes = [
  { path: "/", redirect: "/login" },
  { path: "/login", component: Register ,meta:{
    access:AccessEnum.NOT_LOGIN
    }},
  {
    path: "/mainPage",
    component: mainPage,
    redirect: "/mainPage/article/Category",
    children: [
      { path: "user/Info", component: UserInfo },
      { path: "user/Avatar", component: UserAvatar },
      { path: "user/ResetPsd", component: UserResetPsd },
      { path: "article/Category", component: ArticleCategory },
      { path: "article/Manage", component: ArticleManage },
      { path: "user/Graph",component: graph},
      { path: "ai/chat",component: ChatPage2},
      { path: "ai/userFileList",component: AllMyFileList},
      { path: "user/test",component: test,meta:{
        access:AccessEnum.ADMIN
        }},
      {
        path: "user/app",component: MyApp,
      },
      {
        path: "app/home",component: AppHome,
      },
      {path: "app/detail/:id",component: AppDetail,props: true},
        // # 开始答题
      {path: "/answer/do/:appId/:scoringStrategy",component: AnswerDo,props: true},
        // # 设置题目
      {path: "/add/question/:appId",component: AddQuestion,props: true},
        // # 设置评分结果
      {path: "/add/scoring_result/:appId/:appName/:appType/:scoringStrategy",component: AddScoringResult,props: true},
        // # 查看作答结果
      {path: "/answer/result/:appId",component: UserAnswer,props: true},
      // # 管理用户
      { path: "/admin/user", component: AdminUserPage ,meta:{
          access:AccessEnum.ADMIN
        }},
      { path: "/admin/app", component: AdminAppPage ,meta:{
          access:AccessEnum.ADMIN
        }},
      { path: "/admin/question", component: AdminQuestionPage ,meta:{
          access:AccessEnum.ADMIN
        }},
      { path: "/admin/review", component:  AdminReviewPage,meta:{
          access:AccessEnum.ADMIN
        }},
      { path: "/admin/userAnswer", component:  AdminUserAnswerPage,meta:{
          access:AccessEnum.ADMIN
        }},
    ],
    meta:{
      access:AccessEnum.USER
    }
  },
  { path: "/test", component: test },
  { path: "/NoAuth", component: NoAuth },

];

const Router = createRouter({
  history: createWebHistory(),
  routes: routes,
});

export default Router;
